Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vtctldserver backup #9062

Closed
wants to merge 8 commits into from
Closed

Vtctldserver backup #9062

wants to merge 8 commits into from

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Oct 22, 2021

Description

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

In the original implementation, bidiStream used one channel, `errch`, to
receive both mid-stream errors and "the stream is closed now" errors.
This meant that, due to go's pseudo-random channel selection, if the
stream was closed and there were still messages in the stream (so, both
`ch` and `errch` were select-able), then there was a chance that an
adapter's `Recv()` would return `io.EOF` even though there were still
responses to pull off the stream.

This version moves to a more context-cancel like paradigm, using a
separate context to check if the stream is closed. Then, we adjust the
template for `Recv` to select:

1. Is stream context done
2. Is streamclosed context done
4. Does mid-stream error channel have an error
3. Does message channel have a message

And the template for `Send` to:

1. If streamclosed context done, return `errStreamClosed`; otherwise
2. Send to the message channel and return nil

<hr/>

Note that this commit also makes a more public/exported API for
bidiStream, to set up a simpler (diff-wise) filemove in a later change.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
…vt/vtctl`

Turns out this construct is useful for writing stream-based unit tests
for `grpcvtctldserver`, and this lets us reuse this code there without
exporting it completely.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 closed this Feb 27, 2022
@ajm188 ajm188 deleted the vtctldserver-backup branch February 27, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant